<div id="page_content">
<h2>Listing rents</h2>



<table class="kp_table">
  <tr>
    <th>Customer</th>
    <th>Product</th>
    <th>Date</th>
    <th>Expected return</th>
    <th>Daily charge</th>
    <th>Deposit</th>
    <th></th>
    <th></th>
    <th></th>
    <th></th>
  </tr>

<% Rent.all.each do |rent| %>
  <tr>
    <% customer = Customer.find(rent.customer_id) %>
    <% product = Product.find(rent.product_id) %>
    <td><%= link_to customer.name, customer_path(customer.id) %></td>
    <td><%= link_to product.name, product_path(product.id)%></td>
    <td><%= rent.date %></td>
    <td><%= rent.expected_return %></td>
    <td><%= number_to_currency(rent.day_charge) %></td>
    <td><%= number_to_currency(rent.deposit) %></td>
    <td><%= link_to 'View', rent %></td>
    <td><%= link_to 'Edit', edit_rent_path(rent) %></td>
    <td><%= link_to 'Return', return_rent_path(rent) %>
  </tr>
<% end %>
</table>

<br />

<%= link_to 'New Rent', new_rent_path %>
</div>